﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AbyssCombatLogger
{
        public class Stat
        {
            string target = "";

            public string Target
            {
                get { return target; }
                set { target = value; }
            }
            long damage = 0;

            public long Damage
            {
                get { return damage; }
                set { damage = value; }
            }
            long healing = 0;

            public long Healing
            {
                get { return healing; }
                set { healing = value; }
            }

            private long damageTaken = 0;

            public long DamageTaken
            {
                get { return damageTaken; }
                set { damageTaken = value; }
            }

            //private long threat = 0;

            //public long Threat
            //{
            //    get { return threat; }
            //    set { threat = value; }
            //}

            public Stat(string playerOrEnemy, long damageDone, long healingDone)
            {
                this.target = playerOrEnemy;
                this.damage = damageDone;
                this.healing = healingDone;
                //this.threat = threat;
            }
        }

        public enum StatType
        {
            Damage, Healing, DamageTaken,
            Threat
        }

        public class StatComparer : Comparer<Stat>
        {
            public StatComparer(StatType statSortingType)
            {
                this.sortType = statSortingType;
            }
            private StatType sortType = StatType.Damage;

            /// <summary>
            /// Sorts by highest to lowest, by the indicated statistical measurement
            /// </summary>
            /// <param name="x"></param>
            /// <param name="y"></param>
            /// <returns></returns>
            public override int Compare(Stat x, Stat y)
            {
                switch (sortType)
                {
                    case StatType.Damage:
                        return y.Damage.CompareTo(x.Damage);
                    case StatType.Healing:
                        return y.Healing.CompareTo(x.Healing);
                    case StatType.DamageTaken:
                        return y.DamageTaken.CompareTo(x.DamageTaken);
                    //case StatType.Threat:
                    //    return y.Threat.CompareTo(x.Threat);
                    default:
                        return 0;
                }
            }
        }
}
